<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./../../../WEB-INF/templates/noFooterCompanyTemplate.xhtml">

            <ui:define name="content">
                <h:form id="searchListForm">
                    <p:growl id="searchListGrowl"></p:growl>
                    <p:dialog resizable="false" widgetVar="searchDetailDialog" modal="true" id="searchDetailDialog">
                        <p:panel id="previewDialogPanel" styleClass="previewDialogPanel noMargin noPadding noBorder">
                            <div style="margin-top:-14px;margin-bottom: 15px;">
                                <h:outputText styleClass="viewCandidateLabel" value="#{searchListBean.selectedSearch.description}"></h:outputText>
                                <h:outputText rendered="#{!searchListBean.previewCandidateList.isEmpty()}" styleClass="bodyText block" value="#{messages.NewCandidatesWaiting}"></h:outputText>
                            </div>
                            <p:dataGrid rendered="#{searchListBean.previewCandidateList!=null and !searchListBean.previewCandidateList.isEmpty()}" styleClass="noBorder noMargin noPadding previewFacesDataGrid" emptyMessage="#{messages.NoValidCandidates}" id="facesDataGrid" var="candidate" value="#{searchListBean.previewCandidateList}" columns="3" rows="#{searchListBean.previewCandidateList.size()}" paginator="false" >
                                <p:column styleClass="facesColumn noPadding noMargin noBorder">
                                    <p:panel style="margin-left: 4px;" id="hola" styleClass="noPadding noBorder previewFacesPanel polaroidBackground rotate#{polaroidBean.randomRotation}">  
                                        <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder facesPanel">  
                                            <h:graphicImage rendered="#{candidate.bustBlackWhite==null}" styleClass="imagenBusqueda" library="images" name="bustnotavailable.jpg"></h:graphicImage>                            
                                            <h:graphicImage rendered="#{candidate.bustBlackWhite!=null}" styleClass="imagenBusqueda" value="/candidateFiles/#{candidate.idCandidate.toString()}/images/#{candidate.bustBlackWhite}"></h:graphicImage>                            
                                            <h:outputText styleClass="polaroidText" value="#{candidate.name}, #{candidate.yearsOld}"></h:outputText>
                                        </h:panelGrid>  
                                    </p:panel> 
                                </p:column>
                            </p:dataGrid>
                            <h:outputText rendered="#{searchListBean.previewCandidateList==null or searchListBean.previewCandidateList.isEmpty()}" value="#{messages.NoValidCandidates}"></h:outputText>
                            <p:dataGrid rendered="#{searchListBean.previewCandidateList==null or searchListBean.previewCandidateList.isEmpty()}" styleClass="noBorder noMargin noPadding previewFacesDataGrid" emptyMessage="#{messages.NoValidCandidates}" id="noFacesDataGrid" var="companyAdquiredProfile" value="#{resourcesBean.createIterableList(6)}" columns="3" rows="6" paginator="false" >
                                <p:column styleClass="facesColumn noPadding noMargin noBorder">
                                    <p:panel style="margin-left: 4px;" styleClass="noPadding noBorder previewFacesPanel polaroidBackground rotate#{polaroidBean.randomRotation}">  
                                        <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder facesPanel">  
                                            <h:graphicImage styleClass="imagenBusqueda" library="images" name="bustnotavailable.png"></h:graphicImage>                            
                                        </h:panelGrid>  
                                    </p:panel> 
                                </p:column>
                            </p:dataGrid>
                            <h:panelGrid styleClass="noBorder allWidth marginBottom20 marginTop20" columns="3">
                                <p:commandButton update="searchsDataGrid searchDetailDialog" style="margin-left: 5px;" actionListener="#{searchListBean.deleteSearch()}" styleClass="cropButton educationalBackgroundButton" value="#{messages.Remove}"></p:commandButton>
                                <p:commandButton rendered="#{!searchListBean.selectedSearch.active}" style="margin-left: -15px;" update="previewDialogPanel" actionListener="#{searchListBean.toggleActiveSearch(true)}" styleClass="cropButton personalBackgroundButton" value="#{messages.Activate}"></p:commandButton>
                                <p:commandButton rendered="#{searchListBean.selectedSearch.active}" style="margin-left: -15px;" update="previewDialogPanel" actionListener="#{searchListBean.toggleActiveSearch(false)}" styleClass="cropButton interestBackgroundButton" value="#{messages.Deactivate}"></p:commandButton>
                                <p:commandButton action="#{searchListBean.viewSearch}" style="margin-right: 15px;" styleClass="cropButton imageBackgroundButton floatRight" value="#{messages.ContinueSearching}"></p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                    </p:dialog>
                    <p:panel styleClass="noMargin noPadding noBorder facesWrapPanel">
                        <p:panel styleClass="noBorder noPadding noMargin inlineBlock leftColumnList">
                            <p:commandLink process="@this" action="#{searchListBean.goToNewSearch()}" styleClass="newSearchIcon leftColumnActionButton">
                                <h:outputText styleClass="editIconText" value="#{messages.NewSearch}"></h:outputText>
                            </p:commandLink>
                            <p:panel header="#{messages.NewSearch}" styleClass="noMargin noPadding noBorder inlineBlock leftColumnTip noPaddingTitle titleRight">
                                <h:outputText styleClass="bodyText" value="#{messages.NewSearchText}"></h:outputText>
                            </p:panel>
                        </p:panel>
                        <p:panel styleClass="noBorder noPadding noMargin inlineBlock rightColumnList rightColumnListPanel">
                            <p:dataGrid emptyMessage="" styleClass="noBorder noMargin noPadding" id="searchsDataGrid" var="search" value="#{searchListBean.company.searchList}" columns="#{searchListBean.numberOfColumns}" rows="#{searchListBean.company.searchList.size()}" paginator="false" >
                                <p:panel styleClass="noMargin noPadding noBorder searchPanel">  
                                    <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder allWidth center listInnerPanelGrid">  
                                        <p:commandLink update=":searchListForm:searchDetailDialog" oncomplete="searchDetailDialog.show()" actionListener="#{searchListBean.setSearchAndSearchCandidates(search)}" process="@parent">
                                            <h:graphicImage styleClass="imagenSearch" library="images" name="white-glass.png"></h:graphicImage>                            
                                        </p:commandLink>
                                        <p:inplace styleClass="folderInplace" editor="true">  
                                            <p:ajax event="save" onsuccess="#{searchListBean.editSearchName(search)}"></p:ajax>
                                            <p:inputText value="#{search.description}" required="true" label="text"/>  
                                        </p:inplace>  
                                    </h:panelGrid>  
                                </p:panel> 
                            </p:dataGrid>
                        </p:panel>
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
